﻿using Microsoft.VisualBasic.FileIO;
using System.IO;

namespace CommonUtils
{
    /// <summary>
    /// 文件/文件夹操作类
    /// </summary>
    public static class CoreFileSystem
    {
        /// <summary>
        /// 删除文件/文件夹到回收站
        /// </summary>
        public static void DeleteToRecycleBin(string path)
        => FileSystem.DeleteFile(path, UIOption.OnlyErrorDialogs, RecycleOption.SendToRecycleBin);


        /// <summary>
        /// 删除文件到回收站
        /// </summary>
        public static void DeleteToRecycleBin(this FileSystemInfo file)
        => DeleteToRecycleBin(file.FullName);
    }
}
